<template>
  <div class="common-body-wrapper">
    <search-header
      single-width="130"
      :searchList="searchList"
      @changeHeight="toRetTable"
      @confirmSearch="toSearch"
      @handleChange="handleSearchChange"
      :isSetSingle="false"
      :isCanSwitchStatus="false"
      :isNeedTree="true"
      :paramName="paramName"
      @setSelectedNode="setSelectedNode"
    ></search-header>
    <div class="common-table-tree-wrapper">
      <!-- <table-tree isNeedTree="show" :paramName="paramName" @toggleTreeBox="toggleTreeBox" @setSelectedNode="setSelectedNode" @searchFn="getList">
      </table-tree>-->

      <div class="common-table-wrapper">
        <div class="common-body clearfix" style="overflow-y:auto;">
          <div class="parking-chart-box">
            <div class="parking-data-chart" v-show="lineChart.show" id="ecLine" responsive="true"></div>
            <div class="parking-data-chart" v-show="heatChart.show" id="ec-heat-wrap">
              <div class="ec-heat-header">
                <ul class="list-unstyled">
                  <li
                    v-for="(mark,index) in heatChart.spanMarks"
                    :key="index"
                    @click="getCurrentChart(index,mark.type)"
                  >
                    <span :class="{spanMark:true,'spanMark-none':index!=heatChart.currentMark}"></span>
                    <span v-text="mark.name"></span>
                  </li>
                </ul>
              </div>
              <div id="ecHeat" class="ec-heat" responsive="true"></div>
            </div>
          </div>
          <div class="parking-data-table table-responsive" style="margin:0 10px;" v-cloak>
            <table class="table table-striped table-bordered table-hover" cellspacing="0">
              <thead>
                <tr>
                  <th style="text-align:center;">名称</th>
                  <th
                    v-for="(th,index) in heatChart.spanMarks"
                    :key="index"
                    v-if="index==heatChart.currentMark||heatChart.tableShow[index]"
                  >{{th.name}}数(个)</th>
                </tr>
              </thead>
              <tbody>
                <tr v-if="rowList.length == 0" align="center">
                  <td colspan="7">暂无相关数据。</td>
                </tr>
                <tr v-if="rowList.length>0" v-for="(m, idx) in rowList" :key="idx" align="center">
                  <td>{{m.parkName}}</td>
                  <td v-if="0==heatChart.currentMark||heatChart.tableShow[0]">{{m.totalNum}}</td>
                  <td v-if="1==heatChart.currentMark||heatChart.tableShow[1]">{{m.tempNum}}</td>
                  <td v-if="2==heatChart.currentMark||heatChart.tableShow[2]">{{m.fixedNum}}</td>
                  <td v-if="3==heatChart.currentMark||heatChart.tableShow[3]">{{m.leasedNum}}</td>
                  <td v-if="4==heatChart.currentMark||heatChart.tableShow[4]">{{m.freeNum}}</td>
                  <td v-if="5==heatChart.currentMark||heatChart.tableShow[5]">{{m.bookedNum}}</td>
                </tr>
              </tbody>
            </table>
          </div>
          <!--<div class="table-wrapper">-->
          <!--</div>-->
          <!--<div class="table-footer col-xs-12">-->
          <!--</div>-->
        </div>
      </div>
    </div>
    <big-pic-modal ref="bigPicModal">
      <img
        slot="bigImgSlot"
        :src="bigImgPath | setImgPath"
        alt
        @error="imgError('../../', 'car', $event)"
      />
    </big-pic-modal>
  </div>
</template>

<script>
import common from "@mixins/common.js";

import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";
import BigPicModal from "@components/widgets/BigPicModal.vue";

// image
import images from "@mixins/image.js";

// 引进vue的js
import park_space from "./js/park_space.js";
export default {
  mixins: [common, stardardList, invokeModal, images, park_space],
  components: {
    BigPicModal
  },
  data() {
    var today = [new Date(moment().format("YYYY-MM-DD"))];
    return {
      fixedCols: 3,
      total: 0,
      paramName: "parkId",
      lineChartObj: null,
      heatChartObj: null,
      get_data_timer: null,
      rowList: [],
      lineChart: {
        show: true
      },
      heatChart: {
        show: false,
        currentMark: 6,
        spanMarks: [
          { name: "总车位", class: "spanMarkA", type: "total" },
          { name: "临时车位", class: "spanMarkB", type: "temp" },
          { name: "固定车位", class: "spanMarkC", type: "fixed" },
          { name: "租用车位", class: "spanMarkD", type: "leased" },
          { name: "免费车位", class: "spanMarkE", type: "free" },
          { name: "预定车位", class: "spanMarkF", type: "booked" }
        ],
        tableShow: [true, true, true, true, true, true]
      },
      tmp: {
        xData_line: [],
        xData_heat: []
      },
      //prop-返回数据的字段名称   proisNotInter:true,pNameisNotInter:true,，name-查询字段传参名称    text-显示名称  //initHidden  初始化不显示
      searchList: [
        {
          type: "datePicker",
          isSingle: true,
          flag: "date",
          name: "date",
          text: "时间区间",
          value: today.toString(),
          style: { width: "225px" }
        },
        {
          type: "select",
          isHandleChange: true,
          name: "dimension",
          text: "时间类型",
          value: "day",
          options: [
            { name: "日报", value: "day" },
            { name: "月报", value: "month" }
          ]
        }
      ],
      theadsInfo: [],
      tbodysInfo: []
    };
  },
  methods: {
    confirmSearch(params) {
      this.getList();
    }
  }
};
</script>

<style lang="less" scoped>
.table-bordered {
  border: 1px solid #ddd;
}

.table-bordered > thead > tr > th {
  border: 1px solid #ddd;
  padding: 10px;
}

.table-bordered > tbody > tr > td {
  border: 1px solid #ddd;
  padding: 10px;
}

/*! normalize.css v4.2.0 | MIT License | github.com/necolas/normalize.css */

/**
 * 1. Change the default font family in all browsers (opinionated).
 * 2. Correct the line height in all browsers.
 * 3. Prevent adjustments of font size after orientation changes in IE and iOS.
 */

/* Document
   ========================================================================== */

html {
  font-family: sans-serif;
  /* 1 */
  line-height: 1.15;
  /* 2 */
  -ms-text-size-adjust: 100%;
  /* 3 */
  -webkit-text-size-adjust: 100%;
  /* 3 */
}

/* Sections
   ========================================================================== */

/**
 * Remove the margin in all browsers (opinionated).
 */

body {
  margin: 0;
}

/**
 * Add the correct display in IE 9-.
 */

article,
aside,
footer,
header,
nav,
section {
  display: block;
}

/**
 * Correct the font size and margin on `h1` elements within `section` and
 * `article` contexts in Chrome, Firefox, and Safari.
 */

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/* Grouping content
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 * 1. Add the correct display in IE.
 */

figcaption,
figure,
main {
  /* 1 */
  display: block;
}

/**
 * Add the correct margin in IE 8.
 */

figure {
  margin: 1em 40px;
}

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box;
  /* 1 */
  height: 0;
  /* 1 */
  overflow: visible;
  /* 2 */
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

pre {
  font-family: monospace, monospace;
  /* 1 */
  font-size: 1em;
  /* 2 */
}

/* Text-level semantics
   ========================================================================== */

/**
 * 1. Remove the gray background on active links in IE 10.
 * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
 */

a {
  background-color: transparent;
  /* 1 */
  -webkit-text-decoration-skip: objects;
  /* 2 */
}

/**
 * Remove the outline on focused links when they are also active or hovered
 * in all browsers (opinionated).
 */

a:active,
a:hover {
  outline-width: 0;
}

/**
 * 1. Remove the bottom border in Firefox 39-.
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */

abbr[title] {
  border-bottom: none;
  /* 1 */
  text-decoration: underline;
  /* 2 */
  text-decoration: underline dotted;
  /* 2 */
}

/**
 * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
 */

b,
strong {
  font-weight: inherit;
}

/**
 * Add the correct font weight in Chrome, Edge, and Safari.
 */

b,
strong {
  font-weight: bolder;
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

code,
kbd,
samp {
  font-family: monospace, monospace;
  /* 1 */
  font-size: 1em;
  /* 2 */
}

/**
 * Add the correct font style in Android 4.3-.
 */

dfn {
  font-style: italic;
}

/**
 * Add the correct background and color in IE 9-.
 */

mark {
  background-color: #ff0;
  color: #000;
}

/**
 * Add the correct font size in all browsers.
 */

small {
  font-size: 80%;
}

/**
 * Prevent `sub` and `sup` elements from affecting the line height in
 * all browsers.
 */

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* Embedded content
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 */

audio,
video {
  display: inline-block;
}

/**
 * Add the correct display in iOS 4-7.
 */

audio:not([controls]) {
  display: none;
  height: 0;
}

/**
 * Remove the border on images inside links in IE 10-.
 */

img {
  border-style: none;
}

/**
 * Hide the overflow in IE.
 */

svg:not(:root) {
  overflow: hidden;
}

/* Forms
   ========================================================================== */

/**
 * 1. Change font properties to `inherit` in all browsers (opinionated).
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
  font: inherit;
  /* 1 */
  margin: 0;
  /* 2 */
}

/**
 * Restore the font weight unset by the previous rule.
 */

optgroup {
  font-weight: bold;
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input {
  /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select {
  /* 1 */
  text-transform: none;
}

/**
 * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
 *    controls in Android 4.
 * 2. Correct the inability to style clickable types in iOS and Safari.
 */

button,
html [type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  /* 2 */
}

/**
 * Remove the inner border and padding in Firefox.
 */

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * Change the border, margin, and padding in all browsers (opinionated).
 */

fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
  box-sizing: border-box;
  /* 1 */
  color: inherit;
  /* 2 */
  display: table;
  /* 1 */
  max-width: 100%;
  /* 1 */
  padding: 0;
  /* 3 */
  white-space: normal;
  /* 1 */
}

/**
 * 1. Add the correct display in IE 9-.
 * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
  display: inline-block;
  /* 1 */
  vertical-align: baseline;
  /* 2 */
}

/**
 * Remove the default vertical scrollbar in IE.
 */

textarea {
  overflow: auto;
}

/**
 * 1. Add the correct box sizing in IE 10-.
 * 2. Remove the padding in IE 10-.
 */

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box;
  /* 1 */
  padding: 0;
  /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
  -webkit-appearance: textfield;
  /* 1 */
  outline-offset: -2px;
  /* 2 */
}

/**
 * Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
 */

[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
  -webkit-appearance: button;
  /* 1 */
  font: inherit;
  /* 2 */
}

/* Interactive
   ========================================================================== */

/*
 * Add the correct display in IE 9-.
 * 1. Add the correct display in Edge, IE, and Firefox.
 */

details,
menu {
  display: block;
}

/*
 * Add the correct display in all browsers.
 */

summary {
  display: list-item;
}

/* Scripting
   ========================================================================== */

/**
 * Add the correct display in IE 9-.
 */

canvas {
  display: inline-block;
}

/**
 * Add the correct display in IE.
 */

template {
  display: none;
}

/* Hidden
   ========================================================================== */

/**
 * Add the correct display in IE 10-.
 */

[hidden] {
  display: none;
}

* {
  box-sizing: border-box;
}

input,
button,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

a {
  color: #337ab7;
  text-decoration: none;
}

a:hover,
a:focus {
  color: #23527c;
  text-decoration: none;
}

a:focus {
  outline: thin dotted;
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}

figure {
  margin: 0;
}

img {
  vertical-align: middle;
}

ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

h1 {
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Helvetica Neue", Helvetica, Microsoft Yahei, Hiragino Sans GB,
    WenQuanYi Micro Hei, sans-serif;
  font-size: 14px;
  line-height: 1.42857143;
  color: #333;
  background-color: #ddd;
  overflow: hidden;
  letter-spacing: 0.2px;
}

.parking-chart-box {
  margin: 0 16px;
  overflow: hidden;
}

.parking-dataChart-box {
  padding-top: 25px;
  margin-bottom: 20px;
}

.parking-chart-box .parking-data-chart {
  width: 100%;
  height: 480px;
}

.ec-heat {
  height: 460px;
  width: 100%;
}

.ec-heat-header {
  height: 20px;
  text-align: center;
}

.ec-heat-header ul {
  padding: 0px;
  margin: 0px;
  display: inline-block;
}

.ec-heat-header ul li {
  float: left;
  margin-left: 12px;
  cursor: pointer;
}

.ec-heat-header ul li span {
  display: inline-block;
  vertical-align: middle;
  height: 16px;
  font-size: 12px;
}

.ec-heat-header ul li .spanMark {
  width: 30px;
  margin-right: 0px;
  border-radius: 2px;
}

.ec-heat-header ul li:nth-of-type(1) .spanMark {
  background-color: #c23531;
}

.ec-heat-header ul li:nth-of-type(1) .spanMark-none {
  background-color: #ccc;
}

.ec-heat-header ul li:nth-of-type(2) .spanMark {
  background-color: #314656;
}

.ec-heat-header ul li:nth-of-type(2) .spanMark-none {
  background-color: #ccc;
}

.ec-heat-header ul li:nth-of-type(3) .spanMark {
  background-color: #61a0a8;
}

.ec-heat-header ul li:nth-of-type(3) .spanMark-none {
  background-color: #ccc;
}

.ec-heat-header ul li:nth-of-type(4) .spanMark {
  background-color: #dd8668;
}

.ec-heat-header ul li:nth-of-type(4) .spanMark-none {
  background-color: #ccc;
}

.ec-heat-header ul li:nth-of-type(5) .spanMark {
  background-color: #91c7ae;
}

.ec-heat-header ul li:nth-of-type(5) .spanMark-none {
  background-color: #ccc;
}

.ec-heat-header ul li:nth-of-type(6) .spanMark {
  background-color: #6e7074;
}

.ec-heat-header ul li:nth-of-type(6) .spanMark-none {
  background-color: #ccc;
}

.spanMarkA {
  background-color: #c23531;
}

.spanMarkB {
  background-color: #314656;
}

.spanMarkC {
  background-color: #61a0a8;
}

.spanMarkD {
  background-color: #dd8668;
}

.spanMarkE {
  background-color: #91c7ae;
}

.spanMarkF {
  background-color: #6e7074;
}
</style>